Problem: Let $A,B,C$ be angles of a triangle, where angle $B$ is obtuse, and \begin{align*}
\cos^2 A + \cos^2 B + 2 \sin A \sin B \cos C &= \frac{15}{8} \text{ and} \\
\cos^2 B + \cos^2 C + 2 \sin B \sin C \cos A &= \frac{14}{9}.
\end{align*}There are positive integers $p$, $q$, $r$, and $s$ for which \[ \cos^2 C + \cos^2 A + 2 \sin C \sin A \cos B = \frac{p-q\sqrt{r}}{s}, \]where $p+q$ and $s$ are relatively prime and $r$ is not divisible by the square of any prime.  Find $p+q+r+s$.
Solution: From the equation $\cos^2 A + \cos^2 B + 2 \sin A \sin B \cos C = \frac{15}{8},$
\[\sin^2 A + \sin^2 B - 2 \sin A \sin B \cos C = \frac{1}{8}.\]By the Extended Law of Sines, $\sin A = \frac{a}{2R}$ and $\sin B = \frac{b}{2R},$ so
\[a^2 + b^2 - 2ab \cos C = \frac{R^2}{2}.\]By the Law of Cosines, this is $c^2 = \frac{R^2}{2}.$  But $c = 2R \sin C,$ so
\[\sin^2 C = \frac{1}{8}.\]Since $B$ is obtuse, $C$ is acute, and $\sin C = \frac{\sqrt{2}}{4}.$  We can compute that $\cos C = \frac{\sqrt{14}}{4}.$

The same calculations on the second equation yield $\sin A = \frac{2}{3}$ and $\cos A = \frac{\sqrt{5}}{3}.$  Then
\begin{align*}
\cos B &= \cos (180^\circ - A - C) \\
&= -\cos (A + C) \\
&= -\cos A \cos C + \sin A \sin C \\
&= -\frac{\sqrt{5}}{3} \cdot \frac{\sqrt{14}}{4} + \frac{2}{3} \cdot \frac{\sqrt{2}}{4} \\
&= \frac{2 \sqrt{2} - \sqrt{70}}{12},
\end{align*}so
\begin{align*}
\cos^2 C + \cos^2 A + 2 \sin C \sin A \cos B &= \frac{14}{16} + \frac{5}{9} + 2 \cdot \frac{\sqrt{2}}{4} \cdot \frac{2}{3} \cdot \frac{2 \sqrt{2} - \sqrt{70}}{12} \\
&= \frac{111 - 4 \sqrt{35}}{72}.
\end{align*}The final answer is $111 + 4 + 35 + 72 = \boxed{222}.$